package com.peng.io.bio;

import java.io.IOException;
import java.net.Socket;

/**
 * All rights Reserved, Designed by www.rongdasoft.com
 *
 * @author wangshipeng
 * @version: V1.0
 * @Title: BIOClient.java
 * @Description:
 * @date 2019-11-19 14:20
 * @Copyright: 2019-11-19 www.rongdasoft.com Inc. All rights reseved.
 */
public class BIOClient {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("127.0.0.1", 8888);
        s.getOutputStream().write("HelloServer".getBytes());
        s.getOutputStream().flush();
        //s.getOutputStream().close();
        System.out.println("write over, waiting for msg back...");
        byte[] bytes = new byte[1024];
        int len = s.getInputStream().read(bytes);
        System.out.println(new String(bytes, 0, len));
        s.close();
    }
}
